package com.leoman.service;

import com.leoman.entity.Video;
import com.leoman.entity.VideoRecord;
import com.leoman.entity.vo.*;
import com.leoman.exception.*;
import com.leoman.service.common.ICommonService;
import org.springframework.data.domain.Page;
import org.springframework.web.multipart.MultipartRequest;

import java.util.List;

/**
 * VideoService
 * Created by 涂奕恒 on 2016/10/18 0018 下午 3:13.
 */
public interface VideoService extends ICommonService<Video> {

    // 根据区域id、用户id和分类id查询视频并分页
    Page<VideoRecordVo> iPageForApp(Integer regionId, Integer userId, Integer typeId, Integer pageNum, Integer pageSize)
            throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 查询视频详情
    VideoRecordVo iFindOneForApp(Integer videoRecordId, Integer userId)
            throws ParamErrorException, VideoNotFindException, UserNotFindException, UserSealStatusException;

    // 用户点赞视频or踩视频
    void iPraiseVideo(Integer userId, Integer videoRecordId, Integer type, Integer flag) throws ParamErrorException,
            UserNotFindException,
            VideoNotFindException,
            PraiseNotFindException,
            PraiseExistException,
            TreadNotFindException,
            TreadExistException,
            UserSealStatusException;

    // 用户观看视频获取奖励
    void iGainVideo(Integer userId, Integer videoRecordId) throws ParamErrorException,
            UserNotFindException,
            VideoNotFindException,
            GainExistException,
            GainNotFindException,
            UserSealStatusException,
            GainCountMaxException;

    // 根据企业用户id查询视频并分页
    Page<VideoVo> iPageForCompany(Integer companyUserId, Integer status, Integer pageNum, Integer pageSize)
            throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 查询企业用户视频详情
    VideoVo iFindOneForCompany(Integer videoId) throws ParamErrorException, UserNotFindException, UserSealStatusException;

    // 根据视频id查询视频投放记录列表并分页
    Page<VideoRecord> iRecordPageForCompany(Integer videoId, Integer pageNum, Integer pageSize);

    // 投放视频
    void iSendVideo(Integer videoId,
                    Integer sendType,
                    String regionIds,
                    String regionNames,
                    Long startTime,
                    Long endTime,
                    Double price,
                    Integer count,
                    Integer isOnly,
                    Integer isSend) throws ParamErrorException, VideoNotFindException, MoneyShortException;

    // 删除视频及该视频的所有投放记录
    void iDeleteVideo(Integer videoId, Integer type) throws ParamErrorException, VideoNotFindException;

    // 根据视频id查询该视频的所有简历投放记录列表并分页
    Page<UserResumeVo> iResumePageForVideo(Integer companyUserId, Integer pageNum, Integer pageSize);

    // 企业用户基本数据统计
    StatCompanyUserData iFindInfoByCompanyUserId(Integer companyUserId, Integer index);

    // 企业用户投放数据统计
    StatUserData iFindInfoByCompanyUserIdAndIndex(Integer companyUserId, Integer index, Integer videoId);

    // *
    // *
    // *
    // * 上面的是移动端接口
    // *
    // * 我是分割线
    // *
    // * 下面的是后台的方法
    // *
    // *
    // *

    // 查询新增视频数
    Integer findCountWithNewVideo(Integer index);

    // 根据视频分类ID查询该分类包含的视频列表
    List<Video> findListByVideoTypeId(Integer videoTypeId);

    // 根据视频分类ID查询正常的视频列表
    List<VideoRecord> findListByVideoTypeIdDefault(Integer videoTypeId);

    // 根据审核状态查询视频列表
    List<Video> findListByCheckStatus(Integer checkStatus);

    // 根据下架状态查询视频列表
    List<Video> findListByIsShopping(Integer isShopping);

    // 查询投放中的视频列表
    List<Video> findListByRecordStatus(Integer recordStatus);

    // 查询视频列表（分页）
    Page<Video> pageByParams(Integer companyUserId,
                             String name,
                             String nickName,
                             Integer videoTypeId,
                             Integer sendType,
                             Integer status,
                             Integer sortType,
                             Integer pageNum,
                             Integer pageSize);

    // 查询视频当前状态
    RegionVo getVideoStatus(Video video);

    // 上传视频
    Integer saveVideo(Integer videoId,
                      Integer companyUserId,
                      String name,
                      MultipartRequest multipartRequest,
                      Integer videoTypeId,
                      Integer sendType,
                      String synopsis);

    // 批量修改视频审核状态
    Integer changeVideoCheckStatus(Integer[] videoIds, Integer status);

    // 批量删除视频
    Integer batchDelete(Integer[] videoIds);

    // 删除视频
    Integer deleteByVideoId(Integer videoId);

    // 修改视频上架状态
    Integer changeVideoShopping(Integer videoId, Integer status);

    // 根据企业用户ID查询该用户发布的视频列表
    List<Video> findListByCompanyUserId(Integer companyUserId);
}